package interpreter.bytecodes;

import interpreter.VirtualMachine;
import java.util.Vector;

/**
 * <p>
 * Abstract base class for all types of byte codes.
 * </p><p>
 * Includes common methods for all byte codes
 * </p>
 *
 * @author Kristofer Selbekk
 */
public abstract class ByteCode {

    // Method definitions
    public abstract void exec( VirtualMachine rt );
    public abstract void init( Vector<String> args );
    public abstract Object getArgs();

    /**
     * Representation of byte code
     *
     * Manipulates text and arguments to look good during dump
     *
     * @return string representing the byte code
     */
    public String toString() {
        String out = this.getClass().getSimpleName();
        out = out.substring(0, out.length()-8);
        out = out.toUpperCase();
        
        return out +" "+ getArgs();
    }
}
